using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
namespace Test {
	class ImgProgressive {
		static void MainX() {
			using(Image source=Image.FromFile(@"c:\nx.png"))
			{
				ImageCodecInfo enc=Array.Find<ImageCodecInfo>(ImageCodecInfo.GetImageEncoders(),pred);
				EncoderParameters parameters=new EncoderParameters(3);
				parameters.Param[0]=new EncoderParameter(System.Drawing.Imaging.Encoder.Quality,10L);
				parameters.Param[1]=new EncoderParameter(System.Drawing.Imaging.Encoder.ScanMethod,(int)EncoderValue.ScanMethodInterlaced);
				parameters.Param[2]=new EncoderParameter(System.Drawing.Imaging.Encoder.RenderMethod,(int)EncoderValue.RenderProgressive);
				source.Save(@"C:\saved.jpg",enc,parameters);
			}
		}
		static bool pred(ImageCodecInfo i) { return i.MimeType=="image/jpeg"; }
	}
}
